
local luoshen = fk.CreateSkill{
  name = "mini_ex__luoshen",
}

Fk:loadTranslationTable{
  ["mini_ex__luoshen"] = "洛神",
  [":mini_ex__luoshen"] = "准备阶段，你可以进行判定，若结果为：黑色，你获得之并可以重复此流程；红色，你获得之。",

  ["$mini_ex__luoshen1"] = "洛水清泉流，心波起波澜。",
  ["$mini_ex__luoshen2"] = "山水入画，洛神点绛唇。",
}

luoshen:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player.phase == Player.Start and player:hasSkill(luoshen.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    while true do
      local judge = {
        who = player,
        reason = luoshen.name,
        pattern = ".|.|^nocolor",
      }
      room:judge(judge)
      if judge.card == nil or judge.card.color ~= Card.Black or player.dead or
        not room:askToSkillInvoke(player, {
          skill_name = luoshen.name,
        }) then
        break
      end
    end
  end,
})

luoshen:addEffect(fk.FinishJudge, {
  mute = true,
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and data.reason == luoshen.name and
      data.card and data.card.color ~= Card.NoColor and player.room:getCardArea(data.card) == Card.Processing
  end,
  on_use = function(self, event, target, player, data)
    player.room:obtainCard(player, data.card, true, nil, player, luoshen.name)
  end,
})

return luoshen
